<?php
defined('_JEXEC') or die('Restricted access');
$tmpl = "templates/tpl_automobil/";
$db = JFactory::getDBO();
$sess = JFactory::getSession();
?>
<script type="text/javascript" src="<?php echo $tmpl;?>js/tooltips.js"></script>

<link rel="stylesheet" href="<?php echo $tmpl;?>css/jquery.ui.all.css"/>
<script src="<?php echo $tmpl;?>js/jquery.ui.core.js"></script>
<script src="<?php echo $tmpl;?>js/jquery.ui.widget.js"></script>
<script src="<?php echo $tmpl;?>js/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="<?php echo $tmpl;?>js/jquery.ui.datepicker-da.js"></script>
<link rel="stylesheet" href="<?php echo $tmpl;?>css/datepicker.css"/>
<script>
$(document).ready(function(){
	checkInterior = function(){
		if($('#interior_defect_nej').is(':checked')){
			$('#interior_defect').val('');
			$('#interior_defect').attr('disabled','disabled');
		}
		if($('#interior_defect_ja').is(':checked')){
			$('#interior_defect').removeAttr('disabled');
		}
	}
	checkInterior();
	
	checkFront = function(){
		if($('#front_ja').is(':checked')){
			$('#front').val('');
			$('#front').attr('disabled','disabled');
		}
		if($('#front_nej').is(':checked')){
			$('#front').removeAttr('disabled');
		}
	}
	checkFront();
	
	checkRear = function(){
		if($('#rear_ja').is(':checked')){
			$('#rear').val('');
			$('#rear').attr('disabled','disabled');
		}
		if($('#rear_nej').is(':checked')){
			$('#rear').removeAttr('disabled');
		}
	}
	checkRear();
	
	checkLeft = function(){
		if($('#left_ja').is(':checked')){
			$('#left').val('');
			$('#left').attr('disabled','disabled');
		}
		if($('#left_nej').is(':checked')){
			$('#left').removeAttr('disabled');
		}
	}
	checkLeft();
	
	checkRight = function(){
		if($('#right_ja').is(':checked')){
			$('#right').val('');
			$('#right').attr('disabled','disabled');
		}
		if($('#right_nej').is(':checked')){
			$('#right').removeAttr('disabled');
		}
	}
	checkRight();
	
	submitCar = function(){
		document.getElementById('sendInformationCar').click();
	}
});
</script>
<p><span class="float_left f28">Tilmelding af bil</span><span class="link-login"><a href="index.php?option=com_user&view=user&layout=profile&Itemid=13">
  <?php if($user->guest==0) {echo  "Min Profil";} ;?>
  </a><a href="index.php?option=com_user&view=login&task=logout&Itemid=13" class="m12l">
  <?php if($user->guest==0) {echo  "Log ud";};?>
  </a></span></p>
<div class="cb"></div>
<div class="tt m10b"></div>

<div class="p5t">
    <div class="status-step2"></div>
    <div class="w739 form_tilmelding1 float_left">
    	<form name="infoCar" id="infoCar" method="post">
            <input type="submit" name="sendInformationCar" id="sendInformationCar" style="display:none" />
            <input type="hidden" name="option" value="com_ecommerce" />
            <input type="hidden" name="task" value="saveStep3" />
        <div class="form_tilmelding3 float_left m20t">
        <h3 class="boder_b_d">Indvendig stand </h3>
        
        <input name="clean" type="radio" value="Klargjort til salg" <?php if($sess->get('clean') == 'Klargjort til salg') echo 'checked="checked"';?>/> <span class="pblack m5r">Klargjort til salg</span>
        <input name="clean" type="radio" value="Støvsuget/vasket" <?php if($sess->get('clean') == 'Støvsuget/vasket') echo 'checked="checked"';?>/> <span class="pblack m5r">Støvsuget/vasket</span>
        <input name="clean" type="radio" value="Ikke klargjort" <?php if($sess->get('clean') == 'Ikke klargjort' || !$sess->get('clean')) echo 'checked="checked"';?>/> <span class="pblack">Ikke klargjort</span>
        <div class="cb m5b"></div>
        <textarea class="txa340" style="height:100px;" name="clean_content" cols="" rows="" placeholder="Beskriv stand"><?php echo $sess->get('clean_content');?></textarea>            
        <div class="cb m10t"></div>
        <p class="m10b">Har bilen indvendige fejl i sæder, beklædning eller instrumentpanel?</p>
        <input name="interiorRad" type="radio" id="interior_defect_nej" onchange="checkInterior();" <?php if(!$sess->get('interior_defect')) echo 'checked="checked"';?>/> <span class="pblack m5r">Nej</span>
        <input name="interiorRad" type="radio" id="interior_defect_ja" onchange="checkInterior();" <?php if($sess->get('interior_defect')) echo 'checked="checked"';?>/> <span class="pblack">Ja</span>
        <div class="cb m5b"></div>
        <textarea class="txa340" style="height:100px;" name="interior_defect" id="interior_defect" cols="" rows="" disabled="disabled" placeholder="Beskriv indvendige fejl"><?php echo $sess->get('interior_defect');?></textarea>  
    
        <div class="m20t"></div>
        <h3 class="boder_b_d m10b">Bemærkninger vedrørende udvendig stand</h3>
    
        <textarea class="txa340" style="height:100px;" name="external" cols="" rows="" placeholder="Beskriv omfang af fejlen"><?php echo $sess->get('external');?></textarea>  
             
        <div class="cl"></div>
        
        </div>
        <div class="rightcol-auto m20t m42l w325 float_right">
        <h3 class="boder_b_d">Frontskade <span class="p-16">(beskriv buler, ridser og lign.)</span> </h3>
        <table width="303" cellspacing="0" cellpadding="0" border="0" class="m3b">
          <tbody><tr>
            <td class="w130">
                <img src="<?php echo $tmpl;?>images/auto_1.jpg" alt=""/>
            </td>
            <td>
              <p>Er frontskade fejlfri?</p>
              <input name="frontRad" type="radio" id="front_nej" <?php if($sess->get('front')) echo 'checked="checked"';?> onchange="checkFront();"/> <span class="pblack m5r">Nej</span>
              <input name="frontRad" type="radio" id="front_ja" <?php if(!$sess->get('front')) echo 'checked="checked"';?> onchange="checkFront();"/> <span class="pblack">Ja</span>
              <div class="cb m5b"></div>
              <textarea name="front" id="front" cols="" rows="" class="txa-other" disabled="disabled" placeholder="Beskriv skadens omfang"><?php echo $sess->get('front');?></textarea>              
              </td>
          </tr>
        </tbody>
        </table>
    
        <div class="cb"></div>
        <h3 class="boder_b_d">Bagskade <span class="p-16">(beskriv buler, ridser og lign.)</span> </h3>
        <table width="303" cellspacing="0" cellpadding="0" border="0" class="m3b">
          <tbody><tr>
            <td class="w130">
                <img src="<?php echo $tmpl;?>images/auto_2.jpg" alt=""/>
            </td>
            <td>
              <p>Er bagskade fejlfri?</p>
              <input name="rearRad" type="radio" id="rear_nej" <?php if($sess->get('rear')) echo 'checked="checked"';?> onchange="checkRear();"/> <span class="pblack m5r">Nej</span>
              <input name="rearRad" type="radio" id="rear_ja" <?php if(!$sess->get('rear')) echo 'checked="checked"';?> onchange="checkRear();"/> <span class="pblack">Ja</span>
              <div class="cb m5b"></div>
              <textarea name="rear" id="rear" cols="" rows="" class="txa-other" disabled="disabled" placeholder="Beskriv skadens omfang"><?php echo $sess->get('rear');?></textarea>
              </td>
          </tr>
        </tbody>
        </table>
        <div class="cb"></div>
        <h3 class="boder_b_d">Venstre <span class="p-16">(beskriv buler, ridser og lign.)</span> </h3>
        <table width="303" cellspacing="0" cellpadding="0" border="0" class="m3b">
          <tbody><tr>
            <td class="w130">
                <img src="<?php echo $tmpl;?>images/auto_3.jpg" alt=""/>
            </td>
            <td>
              <p>Er venstre fejlfri?</p>
              <input name="leftRad" type="radio" id="left_nej" <?php if($sess->get('left')) echo 'checked="checked"';?> onchange="checkLeft();"/> <span class="pblack m5r">Nej</span>
              <input name="leftRad" type="radio" id="left_ja" <?php if(!$sess->get('left')) echo 'checked="checked"';?> onchange="checkLeft();"/> <span class="pblack">Ja</span>
              <div class="cb m5b"></div>
              <textarea name="left" id="left" cols="" rows="" class="txa-other" disabled="disabled" placeholder="Beskriv skadens omfang"><?php echo $sess->get('left');?></textarea> 
              
              </td>
          </tr>
        </tbody>
        </table>
        <div class="cb"></div>
        <h3 class="boder_b_d">Højre <span class="p-16">(beskriv buler, ridser og lign.)</span> </h3>
        <table width="303" cellspacing="0" cellpadding="0" border="0" class="m3b">
          <tbody><tr>
            <td class="w130">
                <img src="<?php echo $tmpl;?>images/auto_4.jpg" alt=""/>
            </td>
            <td>
              <p>Er højre fejlfri?</p>
              <input name="rightRad" type="radio" id="right_nej" <?php if($sess->get('right')) echo 'checked="checked"';?> onchange="checkRight();"/> <span class="pblack m5r">Nej</span>
              <input name="rightRad" type="radio" id="right_ja" <?php if(!$sess->get('right')) echo 'checked="checked"';?> onchange="checkRight();"/> <span class="pblack">Ja</span>
              <div class="cb m5b"></div>
              <textarea name="right" id="right" cols="" rows="" class="txa-other" disabled="disabled" placeholder="Beskriv skadens omfang"><?php echo $sess->get('right');?></textarea> 
              
              </td>
          </tr>
        </tbody>
        </table>
    
        </div>
        <div class="cb"></div>
        <div class="m15t">
        	<?php if(JRequest::getVar('action') == 'edit'){?>
            <a href="javascript:void(0);" class="bt_save float_left btn" onclick="submitCar();"></a>
            <input type="hidden" name="action" value="edit" />
            <?php } else {?>
            <a class="bt_next1 float_left btn" href="javascript:void(0);" onclick="submitCar();"></a>
            <a class="btn_back float_left btn m12l" href="index.php?option=com_ecommerce&view=register&Itemid=7&layout=step2"></a>
            <?php }?>
            
        </div>
        </form>
      </div>
    
    </div>